package com.xju.boot_9_10.controller;

import com.xju.boot_9_10.entiy.Employee;
import com.xju.boot_9_10.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Controller
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("index")
    public String index(Model model) {
        Employee employee = employeeService.getById(2);
        List<Employee> list = employeeService.list();
        model.addAttribute("price", 999.99);
        model.addAttribute("str", "字符串");
        model.addAttribute("employee", employee);
        model.addAttribute("color", "red");
        model.addAttribute("list", list);
        // 组员写代码
        // 写代码了
        // 组员
        // 组长
        return "index.html";
    }
}
